package cvsexercise13;

/* import statements for JUnit functionality */
import static org.junit.Assert.*;
import org.junit.Test;

public class TriangleTest {
		
	/* Create a Triangle object and a Shape reference that points
	 * to the Triangle object within a test case. Test that the
	 * two references are the same. Also create a Rectangle object
	 * and point the Shape reference to it, then re-test that the 
	 * two references are the same
	 */
	@Test
	public void testEquality() {
		
		/* Instantiate a Triangle object */
		Triangle myTriangle = new Triangle("white", 1.0, 1.0);
		
		/* Create a Shape reference that points to the Triangle object */
		Shape myShape = myTriangle;
		
		/* Test that the references point to the same object */
		assertSame(myTriangle, myShape);
		
		/* Create a Rectangle object and point the Shape reference to it */
		Rectangle myRectangle = new Rectangle("red", 1.0, 1.0);
		myShape = myRectangle;
		
		/* Test that the references point to the same object */
		assertSame(myTriangle, myShape);
	}
}
